package com.qf.xiangqin.dao;

import com.qf.xiangqin.entity.User;
import com.qf.xiangqin.utils.BaseDao;

public class UserDao {
//    查询密码和用户
    public User selectUser(String username, String password) {
        return BaseDao.querySingle("select * from user where username=? and password=?",
                User.class, username, password);

    }
    //新增
    public int add(User user){
        return BaseDao.update("insert into user(username,password,phone) values(?,?,?)",
                user.getUsername(),user.getPassword(),user.getPhone());
}
//查询通过账号
    public User selectByName(String name){
        return BaseDao.querySingle("select * from user where username=?",User.class,name );
    }
    //
    public int updatePassword(int id,String pass){
        return  BaseDao.update("update user set password=? where id=?",
                pass,id);
    }
}